import Fluent

struct CreateReference: Migration {
    
    func prepare(on database: Database) -> EventLoopFuture<Void> {
        database.schema("reference")
            .id()
            .field("referenceTitle", .string)
            .field("rbm", .string)
            .field("countryIso", .string)
            .field("projectNumbers", .string)
            .field("latitude", .double)
            .field("longitude", .double)
            .field("coordinateIsExact", .bool)
            .field("hasImages", .bool)
            .field("hasVideos", .bool)
            .field("isBreederSystems", .bool)
            .field("isBroilerSystems", .bool)
            .field("isCageFreeSystems", .bool)
            .field("isConventionalLayerSystems", .bool)
            .field("isEnrichedCages", .bool)
            .field("isManureHandling", .bool)
            .field("mainImageFileOcId", .string)
            .field("mainTestimonialImageFileOcId", .string)
            .field("additionalInformation", .string)
            .field("locationName", .string)
            .create()
    }
    
    func revert(on database: Database) -> EventLoopFuture<Void> {
        database.schema("reference").delete()
    }
}
